export default{
	init:function(Vue){
		Vue.prototype.succToast = function(that,title,duration, url) {
			Vue.prototype.uShowToast(that,title,"primary",duration,url);
		}
		Vue.prototype.succ_toast = function(that,title,duration, url) {
			Vue.prototype.uShowToast(that,title,"primary",duration,url);
		}
		Vue.prototype.warnToast = function(that,title, duration,url) {
			Vue.prototype.uShowToast(that,title,"warning",duration,url);
		}
		Vue.prototype.warn_toast = function(that,title,duration, url) {
			Vue.prototype.uShowToast(that,title,"warning",duration,url);
		}
		Vue.prototype.errorToast = function(that,title,duration, url) {
			Vue.prototype.uShowToast(that,title,"error",duration,url);
		}
		Vue.prototype.error_toast = function(that,title,duration, url) {
			Vue.prototype.uShowToast(that,title,"error",duration,url);
		}
		Vue.prototype.infoToast = function(that,title,duration, url) {
			Vue.prototype.uShowToast(that,title,"default",duration,url);
		}
		Vue.prototype.info_toast = function(that,title,duration, url) {
			Vue.prototype.uShowToast(that,title,"default",duration,url);
		}
		Vue.prototype.toastDuration = 2000;
		Vue.prototype.uShowToast = function(that,title, type,duration = Vue.prototype.toastDuration, url) {
			if (url) {
				that.$refs.uToast.show({
					title: title,
					type: type,
					url: url,
					duration:duration
				})
			} else {
				if(that){
					that.$refs.uToast.show({
						title: title,
						type: type,
						duration:duration
					}) 
				}else{
					uni.showToast({
						icon:"none",
						title:title
					})
				}
				
			}
		
		}
	}
}